'''
Author: Leo.wang wanglizhigs@163.com
Date: 2025-09-05 20:36:09
LastEditors: Leo.wang wanglizhigs@163.com
LastEditTime: 2025-09-05 21:11:09
FilePath: /medical-companion-server-python/app/user/serializers.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%A、
'''
from rest_framework import serializers
from .models import McUser, McGender
from app.gender.serializers import McGenderSerializer  

class McUserSerializer(serializers.ModelSerializer):
    gender = McGenderSerializer(read_only=True)  # 嵌套
    gender_id = serializers.PrimaryKeyRelatedField(
        queryset=McGender.objects.all(), source="gender", write_only=True
    )
    class Meta:
        model = McUser
        fields = '__all__'

class McForeignUserSerializer(serializers.ModelSerializer):
    class Meta:
        model = McUser
        fields = ['id','phone','nick_name','real_name','age']